package com.hotline.communication.enums;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public enum PlayRecordTypeEnum {

    //录音类型 0:获取主被叫
    //1:开始放音
    //2:放音结束
    GET_RECORD(0,"获取录音"),
    START_RECORD(1,"开始放音"),
    END_RECORD(2,"放音结束");

    /**
     * 编码
     */
    private Integer code;

    /**
     * 名称
     */
    private String name;

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }



    PlayRecordTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static PlayRecordTypeEnum getRecordTypeEnum(Integer code){
        for (PlayRecordTypeEnum recordTypeEnum : PlayRecordTypeEnum.values()){
            if(recordTypeEnum.getCode().equals(code)){
                return recordTypeEnum;
            }
        }
        return null;
    }

    public static List getPlayRecordTypeEnumEnumList(){
        List list = new ArrayList();
        for (PlayRecordTypeEnum recordTypeEnum : PlayRecordTypeEnum.values()){
            Map map = new HashMap<>();
            map.put("code",recordTypeEnum.getCode());
            map.put("name",recordTypeEnum.getName());
            list.add(map);
        }
        return list;
    }

}
